import random
from ronglian_sms_sdk import SmsSDK

accId = '2c94811c946f6bfb0196ec4eda427815'
accToken = '644e6c1b830a42cda06d7ef372da9f7d'
appId = '2c94811c946f6bfb0196ec4edbdc781c'

def send_message(phone):
    sdk = SmsSDK(accId, accToken, appId)
    # tid是模版，'1'是第一种模版
    tid = '1'
    d = random.randint(0000,9999)
    # d是生成的随机验证码，因为容联云的系统会校验验证码必须是“四位数的数字”，5是验证码的有效期，5分钟内有效
    datas = (d, '5')
    resp = sdk.sendMessage(tid, phone, datas)
    print(resp)
    return resp


